<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>

<!DOCTYPE html>
<html>
<head>
    <title>未确认退货单</title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
</head>

<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">

    <section class="content-header">
        <h1>未确认退货单</h1>
        <ol class="breadcrumb">
             <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
             <li><a href="#">交易</a></li>
            <li><a href="#">药品退货</a></li>
             <li class="active"><a href="#">未确认退货单</a></li>
        </ol>
    </section>
    
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
                <div class="input" style="margin-top:-5px">
                    <div class="textalign1"><spring:message code="message.listForm.TuiHuoDanHao"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                         <input type="text" class="textinput" id="retCode" name="retCode"  placeholder="<spring:message code="message.listForm.TuiHuoDanHao"/>" />
                    </div>
                    <div class="textalign1"><spring:message code="message.listForm.PeiSongQiYe"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                         <input type="text" class="textinput" id="delCompName" name="delCompName"  placeholder="<spring:message code="message.listForm.PeiSongQiYe"/>/<spring:message code="message.listForm.pinYinMa"/>" />
                    </div>
                    <div class="textalign1"><spring:message code="message.listForm.TuiHuoRiQi"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput"> 
                       <table style="width:100%">
                           <tr>
                               <td style="width:50%">
                                   <input id="startDate" name="startDate" type="text" class="textinput" placeholder="yyyy-MM-dd" 
                                       data-date-fmt="yyyy-MM-dd" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'endDate\')}'})" />
                               </td>
                               <td>&nbsp;-&nbsp;</td>
                               <td style="width:50%">
                                   <input id="endDate" name="endDate" type="text" class="textinput"  placeholder="yyyy-MM-dd" 
                                   data-date-fmt="yyyy-MM-dd" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'startDate\')}'})" />
                               </td>
                           </tr>
                       </table>
                    </div>
                    <div class="textalign1" >
                        <button id="selectDicCompType" type="button" class="btn btn-success btn-sm" onclick="search()">
                            <spring:message code="message.button.seachSpacing"/>
                        </button>
                    </div>
                </div>
                    

            </div>
        </div>
        
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
        
    </section>
    
    <%@ include file="/WEB-INF/component/commonJS.jsp"%>
    <script type="text/javascript">
        function showOrderDetail(retCode) {
            $.HN.window.open({
                "id" : "orderDetail",
                "title" : "退货明细",
                "url" : "${ctx}/returnConfirm/toReturnDetail.html?retCode=" + retCode
            });
        }
        
        function orderDetailLink(retCode, text) {
            return "<a href='javascript:showOrderDetail(\"" + retCode + "\")' style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat -100px 0px' class='opIcon' title='明细'></a>";
        }
    
        $(function () {
            //绑定回车
            $('#retCode,#delCompName,#startDate,#endDate').bind('keydown', function(event) {
                if (event.keyCode == "13") {
                    $('#selectDicCompType').click();
                }
            }); 
            $("#retCode").focus();//加载页面光标在第一个查询框内
            
            $("#gridlist").jqGrid({
                url: "getHospReturnInfoDataList.html",
                mtype: "POST",
                datatype: "json",
                autowidth: true,
                shrinkToFit: true,
              //  height: 310,
                colNames: [
                    '<spring:message code="message.jqGrid.cz"/>',
                    '状态',
                    '<spring:message code="message.listForm.TuiHuoDanBianHao"/>',
                    '配送企业',
                    '退货数量',
                    '<spring:message code="message.listForm.ZongJinE"/>',
                    '<spring:message code="message.listForm.TuiHuoShiJian"/>',
                    '<spring:message code="message.listForm.TuiHuoRen"/>'
                ],
                colModel: [
                   { name: 'operate', width: 50,align:"center",sortable:false, 
                       formatter:function(val, opts, row) {
                           return orderDetailLink(row.retCode);
                       }
                   },
                   { name: 'returnStatus', width: 70, align: "center" ,sortable:false },
                   { name: 'retCode', width: 180, align: "center" ,sortable:false },
                   { name: 'delCompName', width: 180, align:"left", sortable:false/* ,
                       formatter:function(val, opts, row){
                           return compInfoLink(row.delCompCode, val, 1);
                       } */
                   },
                   { name: 'detailCount', width: 70, align: "right",sortable:false },
                   { name: 'detailAmount', width: 70, align: "right", sortable:false,
                       formatter:function(val, opts, row){
                           return formatAmount(val);
                       }
                   },
                   { name: 'retDatetime', width: 140, align: "center", sortable:false },
                   { name: 'retUser', width: 180, align: "left", sortable:false }
                ],
                rowNum: 20,
                rowList: [10, 20,50,100],
                rownumbers: true,
                multiselect: false,
                pager: "#gridpage",
                viewrecords: true,
                gridComplete: function(){
                      //序号列宽度自适应（参数为jqgridID）
                      autoRNWidth("gridlist");
                },
                caption: "退货单列表",
                jsonReader: {
                    repeatitems: false,
                    id: "retCode"
                }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
            $("#gridlist").jqGrid("setGridHeight", create());
        });
        
        /* 查询 */
        function search(page) {
            var retCode = $.trim($("#retCode").val());
            var delCompName = $.trim($("#delCompName").val());
            var startDate = $.trim($("#startDate").val());
            var endDate = $.trim($("#endDate").val());
            $("#gridlist").jqGrid("clearGridData");
                $("#gridlist").jqGrid('setGridParam',{  
                mtype: "POST",
                datatype:'json',
                postData:{
                    "retCode":retCode, 
                    "delCompName":delCompName,
                    "startDate":startDate,
                    "endDate":endDate
                },
                page : (page || 1)
            }).trigger("reloadGrid"); //重新载入  
        }
    </script>
</body>
</html>